package com.njegovanobradovic.so.impl;

import org.apache.tapestry5.ioc.annotations.Inject;

import com.njegovanobradovic.core.dao.HibernateDAO;
import com.njegovanobradovic.so.Save;

public class SaveImpl<Type> implements Save<Type> {
	@Inject
	private HibernateDAO dao;
	private Type object;
	
	public Type getObject() {
		return object;
	}

	public void setObject(Type object) {
		this.object = object;
	}

	public Type execute() {
		try {
			dao.save(getObject());
			return getObject();
		} catch (Exception e) {
			return null;
		}
	}
}
